package sk.tuke.constraintbuilder.handler;

import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.handlers.HandlerUtil;

import sk.tuke.constraintbuilder.views.ConstraintExplorerView;

public class ListRefresh extends AbstractHandler {
	
	public static final String COMMAND = "sk.tuke.constraintbuilder.command.listrefresh";

	@Override
	public Object execute(ExecutionEvent event) throws ExecutionException {
		// Get the view
		IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event);
		IWorkbenchPage page = window.getActivePage();
		ConstraintExplorerView listView = (ConstraintExplorerView) page.findView(ConstraintExplorerView.ID);
		//Refresh viewer
		listView.refresh();
		return null;
	}

}
